package samsung.sds.roleManagement.dao;

import java.util.List;

import samsung.sds.roleManagement.model.RoleManagementEntity;
import samsung.sds.roleManagement.model.RoleToResEntity;
import samsung.sds.roleManagement.model.UserToRoleEntity;
import samsung.sds.system.common.baseQuery.BaseMapper;
import samsung.sds.system.common.model.QueryParam;
import samsung.sds.userManagement.model.UserEntity;

/**
 * 
 * @author fei3.liu
 * @createDate 2016-01-26
 *
 */

public interface RoleManagementMapper extends BaseMapper<RoleManagementEntity> {
	
	/**
	 * Get table of SYS_USER_TO_ROLR data by role_name
	 * Data used to determine whether the role of the deletion and user association
	 * 根据角色名称查询SYS_USER_TO_ROLR表中的数据，用与判断角色被用户引用
	 * 
	 * @param id
	 * @return
	 */
	public List<UserToRoleEntity> selectSYS_USER_TO_ROLE(String id);
	
	/**
	 * Get table of SYS_ROLE_TO_RES data by role_name
	 * Data used to determine whether the role of the deletion and user association
	 * 根据角色名称查询SYS_ROLE_TO_RES表中的数据，用与判断角色被资源引用
	 * 
	 * @param id
	 * @return
	 */
	public List<RoleToResEntity> selectSYS_ROLE_TO_RES(String id);

	/**
	 * Initialization viewUserPopup.jsp by role_name
	 * 查询拥有此角色的用户
	 * 
	 * @param id
	 * @return
	 */
	public List<UserEntity> selectSYS_USER01ListPage(QueryParam param);

	/**
	 * The role of the lifting of the relationship with the user
	 * 角色与用户解除关系
	 * 
	 * @param t
	 * @return
	 */
	public int deleteUserToRoleEntity01(UserToRoleEntity userToRoleEntity);

	/**
	 * Add role to user
	 * 给角色添加用户
	 * 
	 * @param userToRoleEntity
	 * @return
	 */
	public int insertSYS_USER_TO_ROLE(UserToRoleEntity userToRoleEntity);

	/**
	 * Query User List Except RoleName
	 * 查询不拥有此角色的用户
	 * 
	 * @param param
	 * @return
	 */
	public List<UserEntity> selectSYS_USER02ListPage(QueryParam param);
	
	/**
	 * Delete RoleName By UserName
	 * 删除该用户的所有角色
	 * 
	 * @param param
	 * @return
	 */
	public int deleteUserToRoleEntity02(String username);
	
	/**
	 * Query UserRole By UserName
	 * 根据用户名获取当前用户的角色
	 * 
	 * @param userName
	 * @return
	 */
	public List<String> getUserRoleByUserName(String userName);

}
